package org.jxf.gps.jt808.message;

import java.util.HashMap;
import java.util.Map;

import org.jxf.gps.jt808.server.GpsServer;

public class MsgBodyHandle {
	protected Message moMsg;
	/**
	 * 默认处理
	 * 返回 false直接断开与设备的连接
	 */
	public boolean doMsg(Message moMsg){
		this.moMsg = moMsg;
		
		Map m = GpsServer.onlineTerminals.get(moMsg.mdn);
		if (m == null){
			m = new HashMap();
		}
		m.put(GpsServer.MO_MSG, moMsg);
		GpsServer.onlineTerminals.put(moMsg.mdn, m);	
		return true;
	}
	
	/**
	 * 默认回包
	 * @return
	 */
	public Message genResp(){
		return MessageParser.genMoSimpleResp(moMsg);
	}
	
}
